package blaha.genalg.methods;

import java.util.ResourceBundle;

/**
 * Reads pre-defined city settings
 * 
 * @author peta
 * 
 */
public class ReadAllProperties {

	transient public Boolean strict;

	transient public Integer xBoard, yBoard, points, minConnectionsToBeSuitable, maxConnections, attemptToJoinPoints, connectionsOnBoard, SLconnectionsOnBoard,
			DistanceStep;
	transient public Float radiusCircle, innerCirclePutPointProbability, minDistance, maxDistance, SLConnectionSuccess;
	transient public Boolean showIsolatedStructures, showInnerCity, showCenter, showOuterBorder, SLconnectionListenToConnectionnumber;

	transient public String outputGraphML;

	public ReadAllProperties() {
		// artificial settings, for testing purpose, replace by settings from
		// file later
		ResourceBundle cityResources = ResourceBundle.getBundle("blaha.genalg.properties.city_properties");

		ResourceBundle outputResources = ResourceBundle.getBundle("blaha.genalg.properties.output_view_properties");

		// ResourceBundle cityResources =
		// ResourceBundle.getBundle("city_properties");
		//		
		// ResourceBundle outputResources =
		// ResourceBundle.getBundle("output_view_properties");

		strict = Boolean.parseBoolean(cityResources.getString("Strict").trim());
		connectionsOnBoard = Integer.parseInt(cityResources.getString("ConnectionsOnBoard").trim());
		xBoard = Integer.parseInt(cityResources.getString("xBoard").trim());
		attemptToJoinPoints = Integer.parseInt(cityResources.getString("AttemptToJoinPoints").trim());
		yBoard = Integer.parseInt(cityResources.getString("yBoard").trim());
		points = Integer.parseInt(cityResources.getString("points").trim());
		innerCirclePutPointProbability = Float.parseFloat(cityResources.getString("innerCirclePutPointProbability").trim());
		radiusCircle = Float.parseFloat(cityResources.getString("radiusCircle").trim());
		minConnectionsToBeSuitable = Integer.parseInt(cityResources.getString("minConnectionsToBeSuitable").trim());
		maxConnections = Integer.parseInt(cityResources.getString("maxConnections").trim());
		minDistance = Float.parseFloat(cityResources.getString("MinDistance").trim());
		maxDistance = Float.parseFloat(cityResources.getString("MaxDistance").trim());
		DistanceStep = Integer.parseInt(cityResources.getString("DistanceStep").trim());

		// SL properties
		SLconnectionsOnBoard = Integer.parseInt(cityResources.getString("SLConnectionsOnBoard").trim());
		SLConnectionSuccess = Float.parseFloat(cityResources.getString("SLConnectionSuccess").trim());
		SLconnectionListenToConnectionnumber = Boolean.parseBoolean(cityResources.getString("SLconnectionListenToConnectionnumber").trim());

		// Show properties
		showIsolatedStructures = Boolean.parseBoolean(outputResources.getString("ShowIsolatedStructures").trim());
		showCenter = Boolean.parseBoolean(outputResources.getString("ShowCenter").trim());
		showInnerCity = Boolean.parseBoolean(outputResources.getString("ShowInnerCity").trim());
		showOuterBorder = Boolean.parseBoolean(outputResources.getString("ShowOuterBorder").trim());
		// output
		outputGraphML = outputResources.getString("OutputGraphML").trim();

	}

	public float getInnerCirclePutPointProbability() {
		return innerCirclePutPointProbability;
	}

	public Integer getxBoard() {
		return xBoard;
	}

	public Integer getyBoard() {
		return yBoard;
	}

	public Float getRadiusCircle() {
		return radiusCircle;
	}

	public Integer getPoints() {
		return points;
	}

	public Integer getMinConnectionsToBeSuitable() {
		return minConnectionsToBeSuitable;
	}

	public Integer getMaxConnections() {
		return maxConnections;
	}

	public Float getMinDistance() {
		return minDistance;
	}

	public Float getMaxDistance() {
		return maxDistance;
	}

	public Integer getAttemptToJoinPoints() {
		return attemptToJoinPoints;
	}

	public Integer getConnectionsOnBoard() {
		return connectionsOnBoard;
	}

	public Boolean getShowIsolatedStructures() {
		return showIsolatedStructures;
	}

	public Boolean getShowInnerCity() {
		return showInnerCity;
	}

	public Boolean getShowCenter() {
		return showCenter;
	}

	public Boolean getShowOuterBorder() {
		return showOuterBorder;
	}

	public Integer getSLconnectionsOnBoard() {
		return SLconnectionsOnBoard;
	}

	public Float getSLConnectionSuccess() {
		return SLConnectionSuccess;
	}

	public Boolean getSLconnectionListenToConnectionnumber() {
		return SLconnectionListenToConnectionnumber;
	}

	public Integer getDistanceStep() {
		return DistanceStep;
	}

	/**
	 * In case, when number of connections is bigger than all possible
	 * connections
	 * 
	 * @param connectionsOnBoard
	 */
	public void setConnectionsOnBoard(Integer connectionsOnBoard) {
		this.connectionsOnBoard = connectionsOnBoard;
	}

	/**
	 * In case defined value is too high
	 * 
	 * @param sLconnectionsOnBoard
	 */
	public void setSLconnectionsOnBoard(Integer sLconnectionsOnBoard) {
		SLconnectionsOnBoard = sLconnectionsOnBoard;
	}

	public Boolean getStrict() {
		return strict;
	}

	/**
	 * Output file
	 * 
	 * @return
	 */
	public String getOutputGraphML() {
		return outputGraphML;
	}

}
